package web;

import com.smart.domain.Calender;
import com.smart.service.CalenderServiceImp;
import com.smart.service.TeacherServiceImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

@Controller
public class CalenderController {
    private CalenderServiceImp calenderServiceImp;
    @Autowired

    public void setCalenderServiceImp(CalenderServiceImp calenderServiceImp) {
        this.calenderServiceImp = calenderServiceImp;
    }
    @RequestMapping(value="/AddCalender.html")
    //增加
    public String a(Calender calender, HttpServletRequest request, HttpServletResponse response){
        int t= Integer.parseInt(request.getParameter("user_term"));
        int w= Integer.parseInt(request.getParameter("user_weeks"));
        Date st=new Date(0,0,0);
        Date sp=new Date(0,0,0);
        calender.setTerm(t);
        calender.setWeek(w);
        calender.setStartday(st);
        calender.setStopday(sp);
        calenderServiceImp.addcal(calender);
        return "main";
    }

}
